<template>
  <div class="news-item">
    <router-link :to="`/detail/${data.id}`" :class="active?'rlink':''">
      <div class="img-box">
        <img v-lazy="data.images[0]" alt="" v-if="data.images && data.images.length > 0" />
        
      </div>
      <h4 class="title">{{data.title}}</h4>
      <p class="desc">{{data.hint}}</p>
    </router-link>
  </div>
</template>
<script setup>
defineProps({
  data:{
    type:Object,
    require:true
  },
  active:{
    type:Boolean,
    default:true
  }
})
</script>

<style lang="less" scoped>
.news-item {
  position: relative;
  padding: 15px 0;
  box-sizing: border-box;
  height: 95px;
  overflow: hidden;
  
  .rlink {
    display: block;
    &:visited :nth-child(-n+2){
      color: #d5d5d5;
    }
  }
  .img-box {
    position: absolute;
    right: 0;
    top: 15px;
    width: 65px;
    height: 65px;
    background-color: #d5d5d5;
    img {
      display: block;
      width: 100%;
      height: 100%;
    }
  }
  .title {
    margin-right: 75px;
    line-height: 25px;
    max-height: 50px;
    overflow: hidden;
    font-size: 16px;
    color: black;
  }
  .desc {
    margin-right: 75px;
    line-height: 15px;
    font-size: 12px;
    color: #555;
  }
}
</style>
